GktIconTheme: Be more careful with paths
authorMatthias Clasen <mclasen@redhat.com>
Mon, 14 Jul 2014 22:44:00 +0000 (18:44 -0400)
committerMatthias Clasen <mclasen@redhat.com>
Mon, 14 Jul 2014 22:44:00 +0000 (18:44 -0400)
Slapping file:// in front of a path does not guarantee a working
uri (e.g. if you are on windows and the path looks like F:\\...).
Therefore, go back to using g_file_new_for_path if we don't have
to deal with a resource.

gtk/gtkicontheme.c

index bf69dd891c675bf491309fe675578fa89ca09f33..42cb138087a65f3407756a2b74a8b905ce490f62 100644 (file)
@@ -1759,7 +1759,6 @@ real_choose_icon (GtkIconTheme       *icon_theme,
 
   if (unthemed_icon)
     {
-      gchar *uri;
       icon_info = icon_info_new (ICON_THEME_DIR_UNTHEMED, size, 1);
 
       /* A SVG icon, when allowed, beats out a XPM icon, but not a PNG icon */
@@ -1772,13 +1771,17 @@ real_choose_icon (GtkIconTheme       *icon_theme,
         icon_info->filename = g_strdup (unthemed_icon->no_svg_filename);
 
       if (unthemed_icon->is_resource)
-        uri = g_strconcat ("resource://", icon_info->filename, NULL);
+        {
+          gchar *uri;
+          uri = g_strconcat ("resource://", icon_info->filename, NULL);
+          icon_info->icon_file = g_file_new_for_uri (uri);
+          g_free (uri);
+        }
       else
-        uri = g_strconcat ("file://", icon_info->filename, NULL);
-      icon_info->icon_file = g_file_new_for_uri (uri);
+        icon_info->icon_file = g_file_new_for_path (icon_info->filename);
+
       icon_info->is_svg = suffix_from_name (icon_info->filename) == ICON_SUFFIX_SVG;
       icon_info->is_resource = unthemed_icon->is_resource;
-      g_free (uri);
     }
 
  out: